home *** CD-ROM | disk | FTP | other *** search
- { status.pas -- Modeless "status" dialog box }
-
- unit Status;
-
- interface
-
- {$R status.res}
-
- uses WinTypes, WinProcs, WObjects;
-
- const
-
- statusID = 'STATUS'; { Dialog resource ID }
-
- type
-
- PStatus = ^TStatus;
- TStatus = object(TDialog)
- ContinueFlag: Boolean;
- constructor Init(AParent: PWindowsObject; AName: PChar);
- procedure ChangeTitle(Title: PChar);
- procedure BeginStatus(StatusLabel: PChar);
- procedure EndStatus;
- procedure Update; virtual;
- procedure Update1(P: PChar);
- procedure Update2(P: PChar);
- procedure Cancel(var Msg: TMessage);
- virtual id_First + id_Cancel;
- function Continue: Boolean;
- end;
-
-
- implementation
-
- const
-
- id_Label = 101;
- id_Status_1 = 102;
- id_Status_2 = 103;
-
-
- {- Construct and initialize TStatus dialog object }
- constructor TStatus.Init(AParent: PWindowsObject; AName: PChar);
- begin
- TDialog.Init(AParent, AName);
- EnableKBHandler;
- ContinueFlag := true
- end;
-
- {- Change dialog caption to a new title }
- procedure TStatus.ChangeTitle(Title: PChar);
- begin
- SetWindowText(HWindow, Title)
- end;
-
- {- Start new modeless dialog operation. Display status label }
- procedure TStatus.BeginStatus(StatusLabel: PChar);
- begin
- SendDlgItemMsg(id_Label, wm_SetText, 0, LongInt(StatusLabel));
- Show(sw_ShowNormal);
- SetFocus(HWindow);
- ContinueFlag := true
- end;
-
- {- Hide the dialog window }
- procedure TStatus.EndStatus;
- begin
- Show(sw_Hide)
- end;
-
- {- Allow keyboard and mouse operation }
- procedure TStatus.Update;
- var
- Msg: TMsg;
- begin
- while PeekMessage(Msg, 0, 0, 0, pm_Remove) do
- if not IsDialogMessage(HWindow, Msg) then
- begin
- TranslateMessage(Msg);
- DispatchMessage(Msg)
- end
- end;
-
- {- Display string P in first update area }
- procedure TStatus.Update1(P: PChar);
- begin
- Update;
- SendDlgItemMsg(id_Status_1, wm_SetText, 0, LongInt(P))
- end;
-
- {- Display string P in second update area }
- procedure TStatus.Update2(P: PChar);
- begin
- Update;
- SendDlgItemMsg(id_Status_2, wm_SetText, 0, LongInt(P))
- end;
-
- {- Handle cancel button }
- procedure TStatus.Cancel(var Msg: TMessage);
- begin
- ContinueFlag := false
- end;
-
- {- Return state of continue flag. False = operation canceled }
- function TStatus.Continue: Boolean;
- begin
- Continue := ContinueFlag
- end;
-
- end.
-
-
- {--------------------------------------------------------------
- Copyright (c) 1991 by Tom Swan. All rights reserved.
- Revision 1.00 Date: 5/15/1991
- ---------------------------------------------------------------}
-